package com.lin.cms.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lin.cms.criteria.ConfigCriteria;
import com.lin.cms.dao.ConfigMapper;
import com.lin.cms.domain.Config;
import com.lin.cms.service.ConfigService;

@Service
public class ConfigServiceImpl implements ConfigService{
	
	public Map<String, String> getMap() {
		List<Config> list = configMapper.selectByExample(new ConfigCriteria());
		Map<String, String> map = new HashMap<String, String>(list.size());
		for (Config config : list) {
			map.put(config.getCfgKey(), config.getCfgValue());
		}
		return map;
	}
	
	public Config getConfigLogin() {
		// TODO Auto-generated method stub
		return Config.create(getMap());
	}
	@Autowired
	private ConfigMapper configMapper;
}
